package com.kdgc.power.file.controller;

import com.kdgc.power.common.util.FileUtil;
import com.kdgc.power.file.service.FileService;
import com.kdgc.power.fw.bean.JsonMsg;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.io.IOException;

@RestController
@RequestMapping("File")
public class FileController {
    @Resource
    private FileService fileService;
    @RequestMapping("delFile")
    public JsonMsg delFile(String path) throws IOException {
        FileUtil.deleteFile(path);
        return new JsonMsg();
    }

    @RequestMapping("findByParentDisk")
    public Object findByParentDisk(String path) throws IOException {
        return fileService.findByParentDisk(path);
    }
}
